package com.k.base.jdk.functions.demo5;

import com.k.base.jdk.functions.demo5.model.Fei;
import com.k.base.jdk.functions.demo5.model.Gan;
import com.k.base.jdk.functions.demo5.model.Heart;

public abstract class AbstractGen implements IGen{
    abstract Heart getHeart();
    abstract Gan getGan();
    abstract Fei getFei();
    public boolean isPerson(){
        String myHeartCode = getHeart().getHeartCode();
        String myGanCode = getGan().getGanCode();
        String myFeiCode = getFei().getFeiCode();
        System.out.println("heart:"+myHeartCode+" gan:"+myGanCode+" fei:"+myFeiCode);
        if(myHeartCode!=null && myGanCode!=null && myFeiCode!=null){
            System.out.println("this is a person");
            return true;
        }else{
            System.out.println("this is not person");
            return false;
        }
    }

    @Override
    public void gen() {
        if(isPerson()){
            System.out.println("start gen:");
        }else{
            System.out.println("gen failed:");
        }
    }
}
